// =============================================================================
//  STATS - Statistical Analysis Tools, v.0.01
//  Copyright (C) 2012  Marco Vettigli
// -----------------------------------------------------------------------------
//
// This program  is free software:  you can  redistribute it and/or  modify it
// under the terms of the  GNU General Public License as published by the Free
// Software Foundation,  either version 3 of the License,  or (at your option)
// any later version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY;  without even  the  implied  warranty  of  MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.  See the  GNU General Public License  for
// more details.
//
// You  should  have received a copy of the  GNU General Public License  along
// with this program.  If not, see <http://www.gnu.org/licenses/>.
//
// =============================================================================
//
// SSCATTERPLOT.H
// The class SScatterPlot diplays a scatter plot composed by two SDoubles
// arrays.
//
// Author: Marco Vettigli
//
// =============================================================================

#ifndef SSCATTERPLOT_H
#define SSCATTERPLOT_H

// == include directives =======================================================

#include <QWidget>
#include <QString>
#include <QColor>
#include <QFont>
#include "core/sdoubles.h"
#include "core/sdoubleaxis.h"
#include "core/stable.h"

// == class definitions ========================================================

namespace StatS {

class SScatterPlot : public QWidget
{

    Q_OBJECT

public:

// == constructors and destructors =============================================

    explicit SScatterPlot(QWidget *parent = 0);

// == getters ==================================================================

    SDoubles* xDataSource() const;

    SDoubles* yDataSource() const;

    STable* linkedTable() const;

// == setters ==================================================================

    bool setDataSources(SDoubles* x,
                        SDoubles* y);

    bool setLinkedTable(STable* table);

    bool setTitle(const QString title);

// == inspectors ===============================================================

    bool isFrameBoxVisible(bool state);

// == accessor function declarations ===========================================

    void setLayout();

protected:

    void paintEvent(QPaintEvent* /*e*/);

signals:

public slots:

    void on_axisPropertiesChanged();

// == variable declarations ====================================================

private:

    SDoubleAxis* _xAxis;        // plot x-axis
    SDoubleAxis* _yAxis;        // plot y-axis

    STable* _table;             // reference to linked table
    SDoubles* _xData;           // reference to x-data array
    SDoubles* _yData;           // reference to y-data array

    QString _title;
    bool _frameBoxState;

    QFont _titleFont;
    QColor _backColor;

// == private function declarations ============================================

};

}

#endif // SSCATTERPLOT_H
